package com.lq.ecoldchain.ui.withdraw.mycard

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.lq.ecoldchain.R
import com.lq.ecoldchain.entity.BankCardEntity

/*
*2019/1/7 0007  16:50
*function by lq
*/
class CardListAdapter(list: List<BankCardEntity>) : BaseQuickAdapter<BankCardEntity, BaseViewHolder>(R.layout.card_item, list) {
    override fun convert(helper: BaseViewHolder, item: BankCardEntity) {
        helper.setText(R.id.bankNameTv, item.bankName)
        val content :String
        content = if (item.bankNo.length > 4) {
            val end = item.bankNo.substring(item.bankNo.length - 4, item.bankNo.length)
            "尾号为${end}的储蓄卡"
        } else{
            item.bankNo
        }
        helper.setText(R.id.bankNoTv, content)
        helper.addOnClickListener(R.id.cardItemRl)
    }

}